<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>企业Hr日报列表</title>
		<link rel="stylesheet" href="../../css/mui.min.css"/>
		<link rel="stylesheet" href="../../css/base.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
		<style>
			html, body {
				background-color: #FFFFFF;
				font-size: 12px;
			}
			.top-chart-div {
				height: 180px;
			}
			.noSign {
				left: 0;
				top: 0;
				margin: 0 auto;
				text-align: center;
				padding: 40px 20px;
				width: 90%;
			}
			.noSign img {
				max-width: 80%;
				display: inline-block;
			}
			.loadFailure {
				left: 0;
				top: 0;
				margin: 0 auto;
				text-align: center;
				padding: 40px 20px;
				width: 90%;
			}
			.loadFailure img {
				max-width: 90%;
				display: inline-block;
			}
			.top_time_div {
				height: 4.5em;
				width: 100%
			}
			.top_time_div .weui_dialog_bd {
				padding: 6px 12px;
				height: 2.5em
			}
			.top_time_div .weui_dialog_bd label {
				line-height: 44px;
				height: 44px;
				float: left
			}
			.top_time_div .weui_select {
				width: 68%;
				height: 38px
			}
			.top_chart_content_div {
				width: 100%;
				height: 250px;
			}
			.top_chart_content_left_div {
				width: 60%;
				float: left
			}
			.top_chart_content_right_div {
				width: 40%;
				float: right
			}
			.top_chart_right_info ul li {
				height: 30px;
				line-height: 30px;
				list-style-type: none;
			}
			.top_chart_left_info ul li {
				height: 30px;
				line-height: 30px;
				list-style-type: none;
			}
			.info_left_div {
				margin: 2px 22%;
			}
			.info_right_div {
				margin: 2px 5%;
			}
			.info_img {
				height: 20px;
				width: 20px;
			}
			.info_span {
				height: 20px;
				line-height: 20px;
				font-size: 14px;
			}
			.icon_img {
				width: 20px;
				height: 20px;
				padding-top: 21px;
			}
			.icon_first_stage {
				background: url(../../icon/icon-fourth-stage.png) 1px 112% no-repeat;
				background-size: 13px
			}
			.icon_second_stage {
				background: url(../../icon/icon-second-stage.png) 1px 112% no-repeat;
				background-size: 13px
			}
			.icon_third_stage {
				background: url(../../icon/icon-first-stage.png) 1px 112% no-repeat;
				background-size: 13px
			}
			.icon_fourth_stage {
				background: url(../../icon/icon-third-stage.png) 1px 112% no-repeat;
				background-size: 13px
			}
			.submit_num {
				font-size: 14px;
				color: #a3d146;
			}
			.nosubmit_num {
				font-size: 14px;
				color: #ff9900;
			}
			.grade_num {
				font-size: 14px;
				color: #f16bae;
			}
			.nograde_num {
				color: #aa68da;
				font-size: 14px;
			}
			.mui-table-view-cell:active {
				background: #fff;
			}
			.font_balck {
				color: #000000
			}
			.time_div {
				float: right;
				width: 35%;
				padding: 15px 0
			}
			.time_div  span {
				color: #000000;
				font-size: 14px;
				padding-left: 50%
			}
			.user-name {
				font-size: 14px;
				margin-left: 2px;
			}
			.star {
				width: 67%;
				margin-top: 5px
			}
			.star img {
				margin-left: 1%;
				width: 18px;
			}
			.people_em {
				margin-left: 2px;
			}
			.type_span {
				margin-top: 4px;
				font-size: 12px;
				margin-left: 2px;
			}
			.user-icon {
				border-radius: 50%;
				margin-top: 3px;
				height: 44px;
				width: 44px;
				line-height: 44px;
			}
			.two_content_div {
				width: 40%;
				float: left;
				padding-top: 2px;
			}
			.time_input {
				border: solid 1px #d9d9d9 !important;
				line-height: 34px;
				position: relative;
				z-index: 1;
				padding-left: 15px;
				width: 68%;
				height: 38px;
				margin-bottom: 0px;
				border-radius: 3px;
			}
			select {
				padding: 1px 15px;
				appearance: none;
				-moz-appearance: none;
				-webkit-appearance: none;
				background: url("../../image/icon_time.png") no-repeat scroll 97% center transparent;
				background-size: 20px;
			}
			.weui_select {
				line-height: 38px;
			}
				.competition-top-tag {
				background-size: 30px;
				background-image: url(../../image/icon_screen_hr.png);
				background-position: center left;
				background-repeat: no-repeat;
				padding-left: 34px;
				font-size: 14px;
				color: #000000;
				line-height: 30px;
				/*   margin-left: 15px;*/
				/*  background-color: #f3f5f7;*/
			}
		</style>
	</head>
	<body>
	<div style=" padding-left: 10px;padding-right: 10px;    margin-top: 10px;">
			<div class="competition-top-tag"  id="classificationId" >
			选择:全部
			</div>
			</div>
		<div class="top_div" >
			<div class="top_time_div">
				<div class="weui_dialog_bd">
					<div data-role="fieldcontain" class=" " id="">
						<label>选择日期:</label>
						<select class="weui_select"  style="float: left;margin-left: 1em" id="selectBar"></select>
					</div>
				</div>
			</div>
			
			<div class="top_chart_content_div" style="display: none" id="chart">
				<div class="top_chart_content_left_div" id="top_chart_div" >
					<div id="top_chart" class="top-chart-div" ></div>
					<div class="top_chart_left_info">
						<ul class="info_left_div">
							<li class="info_li">
								<span class="icon_img icon_first_stage"></span>
								<span class="info_span">已提交:</span>
								<span><em class="submit_num">1</em><em class="people_em">人</em></span>
							</li>
							<li class="info_li">
								<span class="icon_img icon_second_stage"></span>
								<span class="info_span">未提交:</span>
								<span><em class="nosubmit_num">1</em><em class="people_em">人</em></span>
							</li>
						</ul>
					</div>
				</div>
				<div class="top_chart_content_right_div">
					<div id="top_right_chart" class="top-chart-div" ></div>
					<div class="top_chart_right_info">
						<ul class="info_right_div">
							<li class="info_li">
								<span class="icon_img icon_third_stage"></span>
								<span class="info_span">已评分:</span>
								<span><em class="grade_num">1</em><em class="people_em"> 人</em></span>
							</li>
							<li class="info_li">
								<span class="icon_img icon_fourth_stage"></span>
								<span class="info_span">未评分:</span>
								<span><em class="nograde_num">1</em><em class="people_em">人</em></span>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="noSign"  id="noData1" hidden="hidden">
				<img src="../../image/icon_img.png" width="60%" >
				<p class="font16 top_15 base_dark_grey" >
					暂无数据
				</p>
			</div>
		</div>
		<div class="interval"></div>
		<div class="list_div">
			<ul  class="mui-table-view " id="list_div">
				<!--	<li class="mui-table-view-cell mui-media">
				<a href="javascript:;"> <img class="mui-media-object mui-pull-left user-icon" src="../../image/icon_teacher_normal.png">
				<div class="mui-media-body">
				<div style="width: 60%;float: left">
				<span class="user-name font_balck">张三</span>
				<p class="mui-ellipsis entry_tiem_div" >
				<span class="info-span">未审核</span>
				</p>
				</div>
				<div class="time_div" >
				<span >19:30</span>
				</div>
				</div> </a>
				</li>
				<li class="mui-table-view-cell mui-media">
				<a href="javascript:;"> <img class="mui-media-object mui-pull-left user-icon" src="../../image/icon_teacher_normal.png">
				<div class="mui-media-body">
				<div style="width: 60%;float: left">
				<span class="user-name font_balck">张三</span>
				<p class="mui-ellipsis entry_tiem_div" >
				<div class="star left" id="taiduNum12">
				<img src="../../image/icon_xingxing01.png">
				<img src="../../image/icon_xingxing01.png">
				<img src="../../image/icon_xingxing01.png">
				<img src="../../image/icon_xingxing01.png">
				<img src="../../image/icon_xingxing01.png">
				<img src="../../image/icon_xingxing01.png" hidden="hidden">
				</div>
				</p>
				</div>
				<div class="time_div" >
				<span >19:30</span>
				</div>
				</div> </a>
				</li>-->
			</ul>
			<div class="noSign"  id="noData" hidden="hidden">
				<img src="../../image/icon_img.png" width="60%" >
				<p class="font16 top_15 base_dark_grey" >
					暂无数据
				</p>
			</div>
			<div class="loadFailure" id="noNet"  hidden="hidden" >
				<img src="../../image/icon_img01.png" width="60%">
				<p class="" >
					数据加载失败
				</p>
				<p>
					请检查您的网络
				</p>
				<button type="button" class="mui-btn mui-btn-outlined" onclick="RefreshData()">
					重新加载
				</button>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/jquery.min.js"></script>
	<script type="text/javascript" src="../../script/echarts.min.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/timeStampTool.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript">
		var page = 1;
		var rows = 10;
		var refreshCount = 0;
		var sid = '';
		var firstLoad = true;
		var time = "";
		var categoryIsShow = false;
		var cid = '';//企业id
		 var gid = '';//岗位id
		apiready = function() {
			time = timeStringWithTimeStamp(getDefaultDate())
            getDayTimeData();
			loadNewData();
			setRefreshHeader();
			setPullUpRefresh();
			receNotifi();
			 setupNotifi();
			 onSelectCategoryClick();
			 
			sendBuriedNotifi('0',  '实习HR日报', '256')
			
		}
		//获取默认日期
		function getDefaultDate() {
			var now = currentDateTime();
			var nowTime = parseInt(now/1000);
			var day =new Date().getDay();
			var oneDayLong = 24 * 60 * 60;
			var ThursdayTime = nowTime + (5 - day) * oneDayLong-1;
			var DefaultDay="";
			if(day>4||day==0){//如果当前时间大于周4,或者是周日时，默认时间为当前礼拜周四
			  DefaultDay='';
			}else{
			  DefaultDay=nowTime;
			}			
			return DefaultDay;
		}

		function receNotifi() {
			api.addEventListener({
				name : 'TeacherDailyReportList'
			}, function(ret, err) {
				refreshData();
			});
		}
          function setupNotifi(){

			api.addEventListener({
			    name: 'jobCategoryNotifi'
			}, function(ret, err) {
			    cid = ret.value.cId;
			    gid = ret.value.gId;
				var CategoryTitle = ret.value.cTitle;
				var warehouse = ret.value.warehouse;
				if(parseInt(cid) == 0){//全部企业
				$('#classificationId').text("选择: "+"全部");
				}else if(parseInt(gid) == 0){//全部岗位
				$('#classificationId').text("选择: "+warehouse);
				} else{
				  	$('#classificationId').text("选择: "+warehouse+"-"+CategoryTitle);
				}
                 
				categoryIsShow = false;
				loadNewData();
			});
		}
		//下拉刷新
		function setRefreshHeader() {
			api.setRefreshHeaderInfo({
				visible : true,
				bgColor : '#ccc',
				textColor : '#fff',
				textDown : '下拉刷新...',
				textUp : '松开刷新...',
				showTime : true
			}, function(ret, err) {
				loadNewData();
			});
		}

		// 上拉加载
		function setPullUpRefresh() {
			api.addEventListener({
				name : 'scrolltobottom'
			}, function(ret, err) {
				if (refreshCount >= rows) {
					loadMoreData();
				}
			});
		}

		function loadNewData() {
			page = 1;
			loadData();
		}

		function loadMoreData() {
			page++;
			loadData();
		}

		//得到周报提交时间端
		function getDayTimeData() {
			cfnetppPOST(url_getDay, '', true, function(data, status) {
				if (status == 'success') {
					$('#noNet').hide();
					var list = data;
					var classHtmlString = '';
					if (list != null && list.length > 0) {
						for (var i = 0; i < list.length; i++) {
							var classData = list[i];
							classHtmlString += htmlStringWithWeek(classData, i);
						}
						$('#selectBar').append(classHtmlString);
						
						setupClassCellClick();
					} else {
						api.toast({
							msg : '暂无更多数据',
							duration : 2000,
							location : 'bottom'
						});
					}
				} else {
					//					$('#noNet').show();
				}
			});
		}

		function htmlStringWithWeek(classgroup, i) {
			return '<option value="' + (i + 1) + '" time="' + classgroup + '">' + classgroup + ' ' + dayTransformWeek(classgroup) + '</option>';
		
		
		}

		function setupClassCellClick() {
			$("#selectBar").change(function() {
				time = $(this).find("option:selected").attr('time');
				page = 1;
				loadData();
			});
		}

		//获取数据
		function loadData() {
			if (firstLoad == true) {
				showProgress();
				firstLoad = false;
			}
		
			//			time = $("#selectBar option:selected").attr('time')
			var params = {
				jid : $api.getStorage('cfnetppjid'),
				uid : $api.getStorage('cfnetppuid'),
				page : page,
				rows : rows,
				date : time,
				cid :cid,
				gwid:gid
			};
//		console.log(JSON.stringify(params));
			cfnetppPOST(urlhrrblst, params, false, function(data, status) {
			
				api.hideProgress();
				api.refreshHeaderLoadDone();
				if (status == 'success') {
					if (data.code == 200) {
						var dataArray = data.json;
						var listdata = dataArray.lst;
						if (listdata != '' && listdata.constructor == Array && listdata.length > 0) {
							
							$('#noData').hide();
							$('#noNet').hide();
							refreshCount = listdata.length;
					
							writelist(listdata, refreshCount);
						} else {
							if (page == 1) {
								$('#list_div').html('');
								$('#noData').show();
								$('#noNet').hide();
							}
						}
						if (!isObjectEmpty(dataArray.statistics)) {
							$('#chart').show();
							setTopOneChart(dataArray.statistics.submit_num, dataArray.statistics.nosubmit_num);
							setTopTwoChart(dataArray.statistics.grade_num, dataArray.statistics.nograde_num)
						} else {
							$('#chart').hide();
							$('#noData1').show();
							$('#list_div').html('');
						}
					} else if (data.code = 108) {
						if (page == 1) {
							$('#noData').show();
							$('#noNet').hide();
							$('#list_div').html('');
						}
					} else {
						if (page == 1) {
							$('#chart').hide();
							$('#noData').show();
							$('#noData1').show();
							$('#noNet').hide();
							$('#list_div').html('');
						}
					}
				} else {
					if (page > 1) {
						page--;
						refreshCount = rows;
						api.toast({
							msg : '网络异常'
						});
						$('#list_div').html('');
					} else {
						$('#chart').hide();
						$('#noData').hide();
						$('#noNet').show();
						$('#list_div').html('');
					}
				}
			});
		}

		function refreshData() {
			firstLoad = true;
			loadNewData();
		}

		//绘制数据
		function writelist(listdata, len) {
			var htmlsdata = '';
			var timeStr = "";
			var typeStr = "";
			for (var i = 0; i < len; i++) {
				var data = listdata[i];
				var DataArr = JSON.stringify(data).replace(/"/g, '&quot;');
				timeStr = timeWithStamp5(data.instime);
				if (data.reviewstatus == 1) {//已审阅
					typeStr = returnScoreUI(parseInt(data.score));
				} else {
					typeStr = '<span class="type_span">未审核</span>';
				}
				var DataArr = JSON.stringify(data).replace(/"/g, '&quot;');
				var htmls = '<li class="mui-table-view-cell mui-media" onclick="openwin(' + DataArr + ')">' 
				+ '<a href="javascript:;"> <img class="mui-media-object mui-pull-left user-icon" src="' + HeadPortraitIsNull(data.picurl) + '">' 
				+ '<div class="mui-media-body">' 
				+ '<div class="two_content_div">' 
				+ '<span class="user-name font_balck">' + data.rename1 + '</span>' 
				+ '<p class="mui-ellipsis entry_tiem_div" >' + typeStr + '</p>'
				 + '</div>' 
				 + '<div class="time_div" >' 
				 + '<span >' + timeStr + '</span>' 
				 + '</div>' 
				 + '</div> </a>' 
				 + '</li>';
				htmlsdata = htmlsdata + htmls;
			}

			if (page == 1) {

				$('#list_div').html(htmlsdata);
			} else {
				$('#list_div').append(htmlsdata);
			}
		}

		//返回评分视图
		function returnScoreUI(num) {
			var str = ""
			switch(parseInt(num/20)) {
				case 0:
					str = '<div class="star left" id="taiduNum">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '</div>'
					break;
				case 1:
					str = '<div class="star left" id="taiduNum">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '</div>'
					break;
				case 2:
					str = '<div class="star left" id="taiduNum">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '</div>'
					break;
				case 3:
					str = '<div class="star left" id="taiduNum">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '</div>'
					break;
				case 4:
					str = '<div class="star left" id="taiduNum">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue01.png">' 
					+ '</div>'
					break;
				case 5:
					str = '<div class="star left" id="taiduNum">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '<img src="../../image/icon_xingxingblue.png">' 
					+ '</div>'
					break;
			}
			return str;
		}

		//打开考试页
		function openwin(data) {
			data['sourceurl'] = window.location.pathname;
			data['sourcetitle'] = document.title;
		    data['type'] = 3;
				api.openWin({useWKWebView:true,
					name : 'Practice_MasterReportDetail',
					url : '../Practice_Master/Practice_MasterReportDetail.html',
					pageParam : data
				});
			sendBuriedNotifi('1',  '实习HR日报', '256')
		}

		//设置饼图1
		function setTopOneChart(submit_num, nosubmit_num) {
			$('.submit_num').text(MorethanZero(submit_num));
			$('.nosubmit_num').text(MorethanZero(nosubmit_num));
//			$('#top_chart').html('');
			var myChart = echarts.init(document.getElementById('top_chart'));
			myChart.setOption({
				calculable : true,
				series : [{
					name : '访问来源',
					type : 'pie',
					radius : [48, 70],
					center : [110, 100],
				    color : ['#a3d146','#ff9900'],
					x : '10%',
					width : '15%',
					funnelAlign : 'left',
					max : 1048,
					itemStyle : {
						normal : {
							labelLine : {
								show : false
							}
						}
					},
					data : [{
						value : submit_num,
						name : ''
					}, {
						value : nosubmit_num,
						name : ''
					}]
				}]
			},true);
		}

		//设置饼图2
		function setTopTwoChart(grade_num, nograde_num) {
			$('.nograde_num').text(MorethanZero(nograde_num));
			$('.grade_num').text(MorethanZero(grade_num));
//			$('#top_right_chart').html('');
			var myChart = echarts.init(document.getElementById('top_right_chart'));
			myChart.setOption({
				calculable : true,
				series : [{
					name : '访问来源',
					type : 'pie',
					radius : [28, 40],
					center : [60, 100],
					color : ['#f16bae', '#aa68da'],
					x : '10%',
					width : '15%',
					funnelAlign : 'left',
					max : 1048,
					itemStyle : {
						normal : {
							labelLine : {
								show : false
							}
						}
					},
					data : [{
						value : grade_num,
						name : ''
					}, {
						value : nograde_num,
						name : ''
					}]
				}]
			},true);
			//			myChart.on("click", eConsole);
		}
 function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjid'),
				uname : $api.getStorage('cfnetppusername'),
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}
	function onSelectCategoryClick(){
		
		$('#classificationId').unbind('click');
		$('#classificationId').click(function(event){
		
			if (categoryIsShow == true) {
				api.setFrameAttr({
				    name: 'CourseCategoryWind',
				    hidden: true
				});
				categoryIsShow = false;
			}else{
				var y = $(".competition-top-tag").height()+132;
		         var h = api.winHeight - y;
				api.openFrame({
				    name: 'CourseCategoryWind',
				    url: 'CourseCategoryWind.html',
				    rect: {
				        x: 0,
				        y: y,
				        w: 'auto',
				        h: h
				    },
				    bounces: false,
				    bgColor:'rgba(0,0,0,.3)'

				});
				api.setFrameAttr({
				    name: 'CourseCategoryWind',
				    hidden: false
				});
				categoryIsShow = true;
				
			}
			})
		}
	</script>
</html>